<template>
  <!-- 这是网站设置下的网站信息设置 -->
  <div class="information-container">
    <el-card class="box-card">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="网站名称">
          <el-input v-model="form.siteName" />
        </el-form-item>
        <el-form-item label="网站logo">
          <el-input v-model="form.siteLogo" />
        </el-form-item>
        <el-form-item label="底部logo">
          <el-input v-model="form.buttonLogo" />
        </el-form-item>
        <el-form-item label="Slogan">
          <el-input v-model="form.siteSlogan" />
        </el-form-item>
        <el-form-item label="联系电话">
          <el-input v-model="form.customerService" />
        </el-form-item>
        <el-form-item label="备份信息">
          <el-input v-model="form.recordInformation" />
        </el-form-item>
        <el-form-item label="工作时间">
          <el-input v-model="form.operatingHours" />
        </el-form-item>
        <el-form-item label="公众号">
          <el-input v-model="form.officialAccounts" />
        </el-form-item>
        <el-form-item label="客服微信">
          <el-input v-model="form.wecharCustomerService" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click.native.prevent="ChangeSetting">确认</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import {
  getSiteSetting,
  newSetting
} from '@/api/Sitesetting'

export default {
  data() {
    return {
      form: {
        id: '',
        siteName: '',
        siteLogo: '',
        buttonLogo: '',
        siteSlogan: '',
        customerService: '',
        recordInformation: '',
        operatingHours: '',
        officialAccounts: '',
        wecharCustomerService: ''
      }
    }
  },
  created() {
    this.loadInformation()
  },
  methods: {
    // 获取网站信息
    name: 'Information',
    loadInformation() {
      getSiteSetting().then(res => {
        console.log(res)
        this.form = res.data
      })
    },
    // 修改网站信息
    ChangeSetting() {
      newSetting(this.form).then(data => {
        console.log(this.form)
        console.log(data.message)
        // alert(data.msg)
        this.$message({
          type: 'success',
          message: '成功'
        })
      })
    }
  }
}
</script>

<style>

</style>
